package com.example.kx032;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        SeekBar seekBar =findViewById(R.id.seekbar);
        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {


            @Override
            public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
                System.out.println("改变");
                Toast.makeText(MainActivity.this, "进度改变:"+i, Toast.LENGTH_SHORT).show();
            }
            //开始触发方法
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                System.out.println("开始触摸");
            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                System.out.println("停止触摸");
            }
        });


    }
}